import services from './service';
import { modelName } from './config';
import createCRUDModel from '/common/helpers/createCRUDModel';
import { toggleState } from './service'
import { isObject } from 'lodash'

export default createCRUDModel(modelName, services,{
  effects: {
    * toggleState({ payload }, { call, put }) {
      const response = yield call(toggleState, payload);
      if (isObject(response) && (200 === response.status || 1 === response.status)) {
        yield put({
          type:`fetchList`,
          payload:{}
        });
      }
    },
  },
});
